import { request } from '@/utils'

interface MapData {
  id?: number
  name?: string | null
  [key: string]: any
}

interface AudioData {
  id?: number
  name?: string
  [key: string]: any
}

interface QueryParams {
  pageNum?: number
  pageSize?: number
  [key: string]: any
}

export const inspectionMap = {
  create(data: MapData) {
    return request({
      url: '/robot-inspection-map/v1/create',
      method: 'post',
      data
    })
  },
  read(params: QueryParams) {
    return request({
      url: '/robot-inspection-map/v1/list',
      method: 'get',
      params
    })
  },
  update(id: number, data: MapData) {
    return request({
      url: '/robot-inspection-map/v1/update',
      method: 'put',
      data
    })
  },
  delete(id: number) {
    return request({
      url: '/robot-inspection-map/v1/delete/' + id,
      method: 'delete'
    })
  }
}

export const inspectionAudio = {
  create(data: AudioData) {
    return request({
      url: '/robot-inspection-audio/v1/create',
      method: 'post',
      data
    })
  },
  read(params: QueryParams) {
    return request({
      url: '/robot-inspection-audio/v1/list',
      method: 'get',
      params
    })
  },
  update(id: number, data: AudioData) {
    return request({
      url: '/robot-inspection-audio/v1/update',
      method: 'put',
      data
    })
  },
  delete(id: number) {
    return request({
      url: '/robot-inspection-audio/v1/delete/' + id,
      method: 'delete'
    })
  }
}
